package com.youbug.mall.coupon_sms.service.impl;

import com.youbug.mall.coupon_sms.entity.SmsSkuFullReduction;
import com.youbug.mall.coupon_sms.mapper.SmsSkuFullReductionMapper;
import com.youbug.mall.coupon_sms.service.ISmsSkuFullReductionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import com.youbug.common.vo.QueryVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * <p>
 * 商品满减信息 服务实现类
 * </p>
 *
 * @author youbug
 * @since 2024-04-24
 */
@Service
public class SmsSkuFullReductionServiceImpl extends ServiceImpl<SmsSkuFullReductionMapper, SmsSkuFullReduction> implements ISmsSkuFullReductionService {

        @Override
        public IPage<SmsSkuFullReduction> getSmsSkuFullReductionPage(QueryVo<SmsSkuFullReduction> queryVo) {

        Page<SmsSkuFullReduction> paramPage = new Page<>();

        paramPage.setCurrent(queryVo.getCurrentPage());

        paramPage.setSize(queryVo.getPageSize());

        QueryWrapper<SmsSkuFullReduction> wrapper = new QueryWrapper<>();

        SmsSkuFullReduction smsSkuFullReduction = queryVo.getPayload();

        if(!ObjectUtils.isEmpty(smsSkuFullReduction)){
        }
        if(!ObjectUtils.isEmpty(queryVo.getStartTime())){
            wrapper.gt("create_time", queryVo.getStartTime());
        }
        if(!ObjectUtils.isEmpty(queryVo.getEndTime())){
            wrapper.lt("create_time", queryVo.getEndTime());
        }
        wrapper.orderByDesc("create_time");

        Page<SmsSkuFullReduction> page = this.page(paramPage, wrapper);

        return page;
        }

       /* @Transactional(transactionManager = "transactionManagerXXX", rollbackFor = Exception.class)
        public boolean saveBatch(Collection<SmsSkuFullReduction> entityList) {
        return saveBatch(entityList, DEFAULT_BATCH_SIZE);
        }
        */
}
